package com.ccc.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ccc.dao.OrderDao;
import com.ccc.model.Order;
import com.ccc.util.dao.UtilDao;

@Component("orderDao")
public class OrderDaoImpl implements OrderDao {
	private UtilDao utilDao;

	@Override
	public void addOrder(Order order) {
		utilDao.save(order);
	}

	@Override
	public void deleteOrder(Order order) {
		utilDao.delete(order);
	}

	@Override
	public void updateOrder(Order order) {
		utilDao.update(order);
	}

	@Override
	public Order findOrder(int id) {
		return utilDao.find(Order.class, id);
	}

	public UtilDao getUtilDao() {
		return utilDao;
	}

	@Resource
	public void setUtilDao(UtilDao utilDao) {
		this.utilDao = utilDao;
	}

	@Override
	public List<Order> findOrder(String hql, Object[] o) {
		return utilDao.find(hql, o);
	}

}
